/**
 * <p>Title: LoginRest</p>
 * <p>Description: The Interface LoginRest</p>
 * <p>Copyright: Shanghai Batchsight Pharmaceutical Technologies, Inc. Copyright(c) 2016</p>
 * @author qianpengji
 * @version 1.0
 * <pre>Histroy:
 *       2016-11-30  qianpengji  Create
 *</pre>
*/
package cn.jhg.account.rest;

import java.sql.Timestamp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import cn.jhg.account.util.ServiceResult;
@Path("/login")
public interface LoginRest {
	
	/**
     * 用户登录
     * @param account	用户账号
     * @param password  用户密码
     * @return			验证码/erroCode
     */
	@Path("/login")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
	//@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public String login(@FormParam("account") String account,
    		@FormParam("password") String password,
    		@Context HttpServletRequest request);

	/**
     * 用户登出
     * @param uid	            用户id
     * @return			erroCode
     */
	@Path("/logout")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
    public ServiceResult<Object> logout(@FormParam("uid") int uid);
	
	/**
     * 用户修改密码
     * @param account	用户账号
     * @param oldPwd	用户旧密码
     * @param newPwd	用户新密码
     * @return			erroCode
     */
	@Path("/changePassword")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
    public ServiceResult<Object> changePassword(@FormParam("account") String account,
    		@FormParam("oldPwd") String oldPwd,
    		@FormParam("newPwd") String newPwd);

	/**
     * 重置密码
     * @param uid	            用户id
     * @return			erroCode/新密码
     */
	@Path("/resetPassword")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
	public ServiceResult<String> resetPassword(@FormParam("uid") int uid);
	
	/**
     * 获取密码有效期
     * @param uid	            用户id
     * @return			erroCode/密码有效期
     */
	@Path("/getPwdExpiryDate")
    @POST
    @Produces(MediaType.APPLICATION_JSON)
	public ServiceResult<Timestamp> getPwdExpiryDate(@FormParam("uid") int uid);
}
